<template>
	<layout :loading="loading" curPage="gasReplace" :title="data.id ? '修改标准气体更换记录':'新增标准气体更换记录'">
	
		<form class="layui-form" @submit="submit" data-action="/admin/gasReplace/save" data-rediret="/pages/gasReplace/gasReplaceList">
			
			<inputGroup type="text" title="标准物质名称" name="x.name|标准物质名称|0~200" :value="data.name"  placeholder="请输入标准物质名称"></inputGroup>
			
			<inputGroup type="number" title="气体浓度" name="x.gasConcentration|气体浓度|amount" :value="data.gasConcentration"  placeholder="请输入气体浓度"></inputGroup>
			
			<inputGroup type="text" title="单位" name="x.unit|单位|0~20" :value="data.unit"  placeholder="请输入单位"></inputGroup>
			
			<inputGroup type="number" title="数量" name="x.count|数量|amount" :value="data.count"  placeholder="请输入数量"></inputGroup>
			
			<datepicker type="date" title="有效期" name="x.deadline|有效期" :value="data.deadline"></datepicker>
			
			
			<div class="layui-form-item">
				<div class="layui-input-block">
					<input type="hidden" name="x.id" :value="data.id" style="display: none;">
					<button class="layui-btn" form-type="submit">{{ !data.id ? '保存' : '修改'}}</button>
					<button class="layui-btn layui-btn-primary" form-type="reset">重置</button>
					<button class="layui-btn layui-btn-primary" @click="kit.goBack('index')">取消</button>
				</div>
			</div>
		</form>

	</layout>
</template>

<script>
	export default {
		data() {
			return {
				loading: true ,
				data : {
					id : ''
				}
			}
		},
		onLoad(params) {
			this.data.id = params.id || "" ;
			this.loadData();
		},
		onShow() {
			
		},
		methods: {
			
			submit:function(e){
				this.form.submit(e);
			},
			
			loadData : function(e){
				var that = this ;
				var data = {
					id : this.data.id
				} ;
				this.kit.get("/admin/gasReplace/info",data,function(res){
					that.data = res.data || that.data ;	
					that.loading  = false ;
				});
			}
		}
	}
</script>